package com.food.controller;


import com.food.configure.Result;
import com.food.entity.Food;
import com.food.service.FoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author
 * @since 2021-04-04
 */
@RestController
@RequestMapping("/food")
public class FoodController {

    @Autowired
    FoodService foodService;

    /**
     * 添加/修改--菜品信息
     */
    @RequestMapping("/updateFood")
    public Result<Food> updateFood(@RequestBody Food food) {
        return foodService.updateFood(food);
    }

    /**
     * 删除--菜品
     */
    @RequestMapping("/delFood")
    public Result<Food> delFood(@RequestBody Food food) {
        return foodService.delFood(food);
    }

    /**
     * 批量删除
     */
    @RequestMapping("/batchDelFood")
    public Result<Food> batchDelFood(@RequestBody Food food) {
        return foodService.batchDelFood(food);
    }

    /**
     * 查询(不分页)
     */
    @RequestMapping("/queryFood")
    public Result<Food> queryFood(@RequestBody Food food) {
        return foodService.queryFood(food);
    }

    /**
     * 查询(分页)--查找菜品
     */
    @RequestMapping("/queryFoodByPage")
    public Result<Food> queryFoodByPage(@RequestBody Food food) {
        return foodService.queryFoodByPage(food);
    }

    /**
     * 根据ID查询
     */
    @RequestMapping("/queryFoodById")
    public Result<Food> queryFoodById(@RequestBody Food food) {
        return foodService.queryFoodById(food);
    }

}

